import Mustache from 'mustache'
import { getMustacheData } from './handlers'

export const typesTs = async (apiItems: IApiItem[]) => {
    const data = await getMustacheData(apiItems)

    return Mustache.render(
        `{{#data}}
{{#funcParamsTs}}
/**
 * {{title}}请求参数
 */
{{{reqParamsTsInterface}}}
{{/funcParamsTs}}
/**
 * {{title}}响应体
 */
{{{resBodyTsInterface}}}
{{/data}}
`,
        { data },
    )
}
